package org.bing.engine.statistic.helper;

import org.bing.engine.statistic.domain.ContainerStatistics;

public class JsonHelper {

    public static String toJsonString(ContainerStatistics stat) {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        sb.append("class:").append(stat.getClass().getSimpleName());
        sb.append(",globalId:").append(stat.getGlobalId());
        sb.append(",cpuUsage:").append(stat.getCpuUsage());
        sb.append(",memUsage:").append(stat.getMemUsage());
        sb.append(",totalThreadNum:").append(stat.getTotalThreadNum());
        sb.append(",idleThreadNum:").append(stat.getIdleThreadNum());
        sb.append(",queryPerSec:").append(stat.getQueryPerSec());
        sb.append(",inTrafficPerSec:").append(stat.getInTrafficPerSec());
        sb.append(",outTrafficPerSec:").append(stat.getOutTrafficPerSec());
        sb.append("}");
        return sb.toString();
    }
}
